package com.springboot.autoconfigure.oss.config;

import com.springboot.autoconfigure.oss.config.auto.OSSAutoConfiguration;
import com.springboot.autoconfigure.oss.service.OssApiService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Scope;
import org.springframework.context.event.ContextRefreshedEvent;

import java.beans.Introspector;

public abstract class AbstractOSSPropertis   {
    public abstract Class<? extends OssApiService> getImpl();

    /*class RefreshOSSImpl implements BeanDefinitionRegistryPostProcessor,ApplicationListener<ContextRefreshedEvent> {
        private BeanDefinitionRegistry registry;
        @Override
        public void onApplicationEvent(ContextRefreshedEvent event) {
            ApplicationContext applicationContext = event.getApplicationContext();
            applicationContext.getBean(Introspector.decapitalize(getImpl().getSimpleName()));
        }

        @Override
        public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
            this.registry = registry;
        }

        @Override
        public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
            OSSAutoConfiguration.sigleOssApiServiceClazzRegistry(this.registry,getImpl());
        }
    }*/
}
